﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace K3TOOLS.Models
{

    public class UserData
    {
        public static string strPath = Environment.CurrentDirectory + "xxx.dll";

    }
    public partial class BloggingContext : DbContext
    {
        public virtual DbSet<Blog> Blog { get; set; }
        public virtual DbSet<SysOrgAffiliation> SysOrgAffiliation { get; set; }
        public virtual DbSet<TableInfo> TableInfo { get; set; }
        public virtual DbSet<TableColumnData> TableColumnData { get; set; }

        public string StrName = UserData.strPath;
        public BloggingContext(DbContextOptions<BloggingContext> options)
        : base(options)
        {

        }



        public virtual DbSet<apitest1> apitest1 { get; set; }
        //protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        //{
        //    if (!optionsBuilder.IsConfigured)
        //    {
        //        #warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
        //        optionsBuilder.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;");
        //    }
        //}

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Blog>(entity =>
            {
                entity.Property(e => e.Url).IsRequired();
            });

            modelBuilder.Entity<SysOrgAffiliation>(entity =>
            {
                entity.Property(e => e.id).IsRequired();
                entity.Property(e => e.uniqueid).IsRequired();
            });


            modelBuilder.Entity<apitest1>(entity =>
            {
                entity.Property(e => e.id).IsRequired();
            });
        }
    }

 
}
